﻿using Dapper;
using System;
using BCEntity.Trading.Purchase.GoodsPurchase;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading.Tasks;
using BCCommon.TradingEnums;

namespace BCData.Trading.Purchase.GoodsPurchase
{
    /// <summary>
    /// 商品采购单
    /// </summary>
    public interface IGoodsPurchaseData
    {
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// <param name="goodsPurchaseId">商品采购单Id</param>
        Task<bool> Exists(long goodsPurchaseId);
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// <param name="goodsPurchaseNo">商品采购单编号</param>
        Task<bool> Exists(string goodsPurchaseNo);
        /// <summary>
        /// 增加商品采购单
        /// </summary>
        /// <param name="entity">商品采购单信息</param>
        Task<GoodsPurchaseEntity> Add(GoodsPurchaseEntity entity);
        /// <summary>
        /// 更新商品采购单
        /// </summary>
        /// <param name="entity">商品采购单信息</param>
        Task<GoodsPurchaseEntity> Update(GoodsPurchaseEntity entity);
        /// <summary>
        /// 删除商品采购单
        /// </summary>
        /// <param name="goodsPurchaseId">商品采购单Id</param>
        Task<bool> Delete(long goodsPurchaseId);
        /// <summary>
        /// 获取商品采购单
        /// </summary>
        /// <param name="goodsPurchaseId">商品采购单Id</param>
        Task<GoodsPurchaseEntity> GetEntity(long goodsPurchaseId);
        /// <summary>
        /// 获取商品采购单分页列表
        /// </summary>
        /// <param name="purchaseNo">采购单编号</param>
        /// <param name="purchaseInventoryStatusType">采购库存状态类型</param>
        /// <param name="purchaseDateType">采购日期类型</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="sortName">排序字段</param>
        /// <param name="ascending">升序</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        Task<(IEnumerable<GoodsPurchaseEntity>, int)> Query(string purchaseNo, PurchaseInventoryStatusType? purchaseInventoryStatusType, PurchaseDateType? purchaseDateType, DateTime? start, DateTime? end, string sortName, bool? ascending, int pageIndex, int pageSize);
        #endregion  成员方法
        /// <summary>
        /// 修改采购状态
        /// </summary>
        /// <param name="goodsPurchaseId">商品采购单Id</param>
        /// <param name="purchaseStatusType">采购状态</param>
        /// <returns></returns>
        Task<bool> UpdatePurchaseStatus(long goodsPurchaseId, PurchaseStatusType purchaseStatusType);
        /// <summary>
        /// 更新定金支付信息
        /// </summary>
        /// <param name="goodsPurchaseEntity">商品采购单信息</param>
        /// <returns></returns>
        Task<GoodsPurchaseEntity> UpdateDepositePaymentInfo(GoodsPurchaseEntity goodsPurchaseEntity);
        /// <summary>
        /// 更新尾款支付信息
        /// </summary>
        /// <param name="goodsPurchaseEntity">商品采购单信息</param>
        /// <returns></returns>
        Task<GoodsPurchaseEntity> UpdateLastPaymentInfo(GoodsPurchaseEntity goodsPurchaseEntity);
        /// <summary>
        /// 更新交付信息
        /// </summary>
        /// <param name="goodsPurchaseEntity">商品采购单信息</param>
        /// <returns></returns>
        Task<GoodsPurchaseEntity> UpdateDeliveryInfo(GoodsPurchaseEntity goodsPurchaseEntity);
        /// <summary>
        /// 修改暂停采购备注
        /// </summary>
        /// <param name="goodsPurchaseEntity">商品采购单信息</param>
        /// <returns></returns>
        Task<GoodsPurchaseEntity> UpdateSuspendRemark(GoodsPurchaseEntity goodsPurchaseEntity);
        /// <summary>
        /// 修改暂停恢复采购备注
        /// </summary>
        /// <param name="goodsPurchaseEntity">商品采购单信息</param>
        /// <returns></returns>
        Task<GoodsPurchaseEntity> UpdateRestoreRemark(GoodsPurchaseEntity goodsPurchaseEntity);
        /// <summary>
        /// 修改停止采购备注
        /// </summary>
        /// <param name="goodsPurchaseEntity">商品采购单信息</param>
        /// <returns></returns>
        Task<GoodsPurchaseEntity> UpdateStopRemark(GoodsPurchaseEntity goodsPurchaseEntity);

        /// <summary>
        /// 修改采购单定金凭证信息
        /// </summary>
        /// <param name="goodsPurchaseEntity">商品采购单信息</param>
        /// <returns></returns>
        Task<GoodsPurchaseEntity> UpdateDepositeCertificate(GoodsPurchaseEntity goodsPurchaseEntity);
        /// <summary>
        /// 修改采购单尾款凭证信息
        /// </summary>
        /// <param name="goodsPurchaseEntity">商品采购单信息</param>
        /// <returns></returns>
        Task<GoodsPurchaseEntity> UpdateLastPaymentCertificate(GoodsPurchaseEntity goodsPurchaseEntity);
    }


}